<%--
  Created by IntelliJ IDEA.
  User: Q倘若
  Date: 2021/2/11
  Time: 20:15
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>登录</title>
    <script src="statics/js/jquery-3.4.1.min.js"></script>
    <script>
        function a1() {
            $.post({
                url:"${pageContext.request.contextPath}/a3",
                data:{"name":$("#name").val()},
                success:function (data) {
                    console.log(data);
                    if(data.toString()==="ok"){
                        $("#nameInfo").css("color","green");
                    }else{
                        $("#nameInfo").css("color","red");
                    }
                    $("#nameInfo").html(data);
                }
            });
        }

        function a2() {
            $.post({
                url:"${pageContext.request.contextPath}/a3",
                data:{"pwd":$("#pwd").val()},
                success:function (data) {
                    console.log(data);
                    if(data.toString()==="ok"){
                        $("#pwdInfo").css("color","green");
                    }else{
                        $("#pwdInfo").css("color","red");
                    }
                    $("#pwdInfo").html(data);
                }
            });
        }
    </script>
</head>
<body>
<p>
    用户名：<input type="text" id="name" onblur="a1()" />
    <span id="nameInfo"></span>
</p>
<p>
    密码：<input type="text" id="pwd"  onclick="a2()"/>
    <span id="pwdInfo"></span>
</p>

</body>
</html>
